import { get, post } from '@/utils/request'

const BASE_URL = window.baseUrl.ticket

// 工单列表（分页查询）
export function queryList(query) {
  return post(BASE_URL + '/order/query', query)
}
//  新建工单
export function saveWork(query) {
  return post(BASE_URL + '/order/save', query)
}
//  工单详情查询
export function queryDetail(query) {
  return get(BASE_URL + '/order/detail', query)
}
//  工单历史查询
export function queryHistory(query) {
  return get(BASE_URL + '/order/history', query)
}
//  工单执行
export function executeWork(query) {
  return post(BASE_URL + '/order/execute', query)
}
//  工单驳回
export function rejectWork(query) {
  return post(BASE_URL + '/order/reject', query)
}

//  强制转派
export function transfer(query) {
  return post(BASE_URL + '/order/transfer', query)
}

//  工单评论
export function addComment(query) {
  return post(BASE_URL + '/order/addComment', query)
}

//  工单撤销
export function revokeWork(query) {
  return post(BASE_URL + '/order/revoke', query)
}
//  删除工单
export function deleteWork(query) {
  return post(BASE_URL + '/order/delete', query)
}
//  查询流程列表
export function listAllFlowMap(query) {
  return get(BASE_URL + '/flow/listAllFlowMap', query)
}
//  查询所有用户
export function getAllUser(query) {
  return get(BASE_URL + '/commonUser/getAllUser', query)
}
// 查询角色下所有用户
export function getUserByRoleIds(query) {
  return get(BASE_URL + '/commonUser/getUserByRoleIds', query)
}
//  获取表单变量
export function getFormVariables(query) {
  return get(BASE_URL + '/flow/getFormVariables?flowId=' + query)
}
// 查询全部流程列表（不分页）
export function listAllFlow(query) {
  return post(BASE_URL + '/serviceDef/listServiceFlow', query)
}
//  创建（更新）草稿
export function saveDraft(query) {
  return post(BASE_URL + '/order/draft/save', query)
}
//  查询强制转派人员列表
export function queryUserByOrderId(query) {
  return get(BASE_URL + '/order/queryUserByOrderId', query)
}
// 根据ID查询工单详情
export function getById(query) {
  return get(BASE_URL + '/order/getById', query)
}

// 下一个节点的信息
export function getNextNodeInfo(query) {
  return get(BASE_URL + '/order/getNextNodeInfo', query)
}

/**  工单-草稿箱 */

// 查询草稿详情
export function getDraft(query) {
  return get(BASE_URL + '/order/draft/get', query)
}
// 分页查询草稿箱
export function pageQueryDraft(query) {
  return post(BASE_URL + '/order/draft/pageQuery', query)
}
// 批量删除接口
export function deleteDraft(query) {
  return post(BASE_URL + '/order/draft/delete', query)
}

/** 上传文件  */
export function fileUpload(query) {
  return post(BASE_URL + '/attachment/upload', query)
}